package c.e.a.b.f.b;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.IInterface;
import c.e.a.b.e.c.d3;
import c.e.a.b.e.c.e2;
import c.e.a.b.e.c.e3;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class l4 implements ServiceConnection {
    public final String a;
    public final /* synthetic */ m4 b;

    public l4(m4 m4Var, String str) {
        this.b = m4Var;
        this.a = str;
    }

    public final void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        if (iBinder == null) {
            this.b.a.d().i.a("Install Referrer connection returned with null binder");
            return;
        }
        try {
            e2 e2Var;
            int i = e3.a;
            IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.finsky.externalreferrer.IGetInstallReferrerService");
            if (queryLocalInterface instanceof e2) {
                e2Var = (e2) queryLocalInterface;
            } else {
                e2Var = new d3(iBinder);
            }
            if (e2Var == null) {
                this.b.a.d().i.a("Install Referrer Service implementation was not found");
                return;
            }
            this.b.a.d().n.a("Install Referrer Service connected");
            this.b.a.a().v(new o4(this, e2Var, this));
        } catch (Exception e) {
            this.b.a.d().i.b("Exception occurred while calling Install Referrer API", e);
        }
    }

    public final void onServiceDisconnected(ComponentName componentName) {
        this.b.a.d().n.a("Install Referrer Service disconnected");
    }
}
